package com.lifo.good.service.serviceimpl;

import com.lifo.good.bean.model.HfCategory;
import com.lifo.good.dao.SearchGoodCategoryMapper;
import com.lifo.good.service.SearchGoodCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2018/5/11.
 */
@Service
@Slf4j
public class SearchGoodCategoryServiceImpl implements SearchGoodCategoryService {


    @Autowired
    private SearchGoodCategoryMapper searchGoodCategoryMapper;

    @Override
    public List<HfCategory> searchHfCategory() {
        try{
            return searchGoodCategoryMapper.searchHfCategory();
        }catch (Exception e){
            log.error("查询二级目录时发生异常，异常信息为==>{}",e.getMessage());
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public List<HfCategory> searchHfCatgegoryOneLevel() {
        try{
            return searchGoodCategoryMapper.searchHfCatgegoryOneLevel();
        }catch (Exception e){
            log.error("查询一级目录时发生异常，异常信息为==>{}",e.getMessage());
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public List<HfCategory> searchHfCategoryTwoLevelByOneLevel(Long firstLevel) {
        try{
            return  searchGoodCategoryMapper.searchHfCategoryTwoLevelByOneLevel(firstLevel);
        }catch (Exception e){
            log.error("通过一级目录查询二级目录时发生异常，异常信息为==>{}",e.getMessage());
            e.printStackTrace();
        }
        return null;
    }
}
